home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / vgamaze4.zip / TITILLAT.CPP < prev    next >
C/C++ Source or Header  |  1994-02-14  |  2KB  |  77 lines

  1. #include <stdio.h>
  2. #include <dos.h>
  3. #include "titillat.h"
  4.  
  5. titillator::titillator()
  6.   {
  7.      union REGS in;
  8.      union REGS out;
  9.  
  10.      titillation[0]=(unsigned char) '|';
  11.      titillation[1]=(unsigned char) '/';
  12.      titillation[2]=(unsigned char) '-';
  13.      titillation[3]=(unsigned char) '\\';
  14.      in.h.ah=(unsigned char) 8;
  15.      in.h.bh=(unsigned char) '\0';
  16.      int86(0x10,&in,&out);         // get original character and attribute
  17.      original_attribute=out.h.ah;
  18.      original_character=out.h.al;
  19.      in.h.ah=(unsigned char) '\3';
  20.      in.h.bh=(unsigned char) '\0';
  21.      int86(0x10,&in,&out);         // get cursor
  22.      cursor_row=out.h.dh;
  23.      cursor_column=out.h.dl;
  24.      cursor_start=out.h.ch;
  25.      cursor_stop=out.h.cl;
  26.      in.h.ah=(unsigned char) '\1';
  27.      in.h.bh=(unsigned char) '\0';
  28.      in.h.ch=(unsigned char) 32;
  29.      in.h.cl=(unsigned char) 32;
  30.      int86(0x10,&in,&out);        // make cursor disappear
  31.      titillation_index=0;
  32.    }
  33.  
  34. titillator::~titillator()
  35.    {
  36.       union REGS in;
  37.       union REGS out;
  38.  
  39.       in.h.ah=(unsigned char) '\2';
  40.       in.h.bh=(unsigned char) '\0';
  41.       in.h.dh=cursor_row;
  42.       in.h.dl=cursor_column;
  43.       int86(0x10,&in,&out);        // set cursor position
  44.       in.h.ah=(unsigned char) 9;
  45.       in.h.al=original_character;
  46.       in.h.bh=(unsigned char) '\0';
  47.       in.h.bl=original_attribute;
  48.       in.x.cx=1;
  49.       int86(0x10,&in,&out);        // restore original character
  50.       in.h.ah=(unsigned char) '\1';
  51.       in.h.bh=(unsigned char) '\0';
  52.       in.h.ch=cursor_start;
  53.       in.h.cl=cursor_stop;
  54.       int86(0x10,&in,&out);        // restore cursor to its original state
  55.    }
  56.  
  57. void titillator::titillate()
  58.     {
  59.       union REGS in;
  60.       union REGS out;
  61.  
  62.       in.h.ah=(unsigned char) '\2';
  63.       in.h.bh=(unsigned char) '\0';
  64.       in.h.dh=cursor_row;
  65.       in.h.dl=cursor_column;
  66.       int86(0x10,&in,&out);        // set cursor position
  67.       titillation_index++;
  68.       if (titillation_index > 3)
  69.         titillation_index=0;
  70.       in.h.ah=(unsigned char) 10;
  71.       in.h.al=titillation[titillation_index];
  72.       in.h.bh=(unsigned char) '\0';
  73.       in.h.bl=(unsigned char) 15;
  74.       in.x.cx=1;
  75.       int86(0x10,&in,&out);        // output character
  76.     }
  77.